package com.example.demo2.config;

import com.example.demo2.util.RabbitMqUtils;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DeadRabbitMqConfigation {
    //创建交换机 路由模式
    @Bean
    public DirectExchange directExchange_dead(){
        return new DirectExchange(RabbitMqUtils.DEAD_EXCHANGE,true,false);
    }
    //创建队列
    @Bean
    public Queue dead(){
        return new Queue("dead",true);
    }
    //队列绑定交换机
    @Bean
    public Binding bindingdead(){
        return BindingBuilder.bind(dead()).to(directExchange_dead()).with("dead");
    }
}
